﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace SharedGenomics.Core.Collections
{
    public class Tree<T>
    {
        private readonly IEqualityComparer<T> _comparer;

        public Tree()
            : this(EqualityComparer<T>.Default)
        {
        }

        public Tree(IEqualityComparer<T> comparer)
        {
            this._comparer = comparer ?? EqualityComparer<T>.Default;
        }

        public TreeNode<T> Root { get; set; }

        public TreeNode<T> CreateNode(T value)
        {
            return new TreeNode<T>(value, this._comparer);
        }

        public TreeNode<T> CreateNode(T value, IEnumerable<TreeNode<T>> children)
        {
            return new TreeNode<T>(value, this._comparer, children);
        }
    }
}
